package O4.arr;

import java.util.Arrays;

public class MultiDeminArray {
    public static void main(String[] args) {
        int [][] ns = {
                {1, 2, 3, 4},
                {11, 12, 13, 14},
                {21, 22, 33, 34},
        };
        System.out.println(ns.length);
        System.out.println(ns[2].length);
        System.out.println(Arrays.deepToString(ns));

        // 用二维数组表示的学生成绩:
        int[][] scores = {
                { 82, 90, 91 },
                { 68, 72, 64 },
                { 95, 91, 89 },
                { 67, 52, 60 },
                { 79, 81, 85 },
        };
        double sum =0;
        int counter=0;

        for (int m=0;m<scores.length;m++){
            for (int j:scores[m]){
                sum += j;
                counter ++;
            }
        }
        double average = 0;
        average = sum / counter;
        System.out.println(average);
        if (Math.abs(average - 77.733333) < 0.000001) {
            System.out.println("测试成功");
        } else {
            System.out.println("测试失败");
        }

    }
}
